//
//  ZXLoginReigiserViewController.m
//  XiMaFM
//
//  Created by fanzhuxian on 2017/9/2.
//  Copyright © 2017年 hcios. All rights reserved.
//

#import "ZXLoginReigiserViewController.h"

#import "ZxFMLoginTableViewController.h"

#import "ZXPasswordLoginViewController.h"
#import "ZXFastLoginViewController.h"
#import "ZXRegiserViewController.h"

#import "SelectedView.h"

@interface ZXLoginReigiserViewController ()

@end

@implementation ZXLoginReigiserViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title = @"登录";
    
    [self setupNav];
    
    self.view.backgroundColor = [UIColor whiteColor];

    [self setupViews];
}

- (void)setupNav {
    
    UIButton * rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
//    [rightBtn setFrame:CGRectMake(0, 0, 60, 40)];
    //    [rightBtn setBackgroundColor:[UIColor redColor]];
    [rightBtn setTitle:@"注册" forState:UIControlStateNormal];
    [rightBtn setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
    [rightBtn.titleLabel setFont:[UIFont systemFontOfSize:14]];
    [rightBtn sizeToFit];
    [rightBtn addTarget:self action:@selector(didClickRight) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem * rightBarBtn = [[UIBarButtonItem alloc] initWithCustomView:rightBtn];
    self.navigationItem.rightBarButtonItem = rightBarBtn;
    
    UIButton * leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
//    [leftBtn setFrame:CGRectMake(0, 0, 64, 40)];
    [leftBtn setImage:[UIImage imageNamed:@"icon_back_h"] forState:UIControlStateNormal];
    [leftBtn setImage:[UIImage imageNamed:@"icon_back_highlight"] forState:UIControlStateHighlighted];
    [leftBtn sizeToFit];
    [leftBtn addTarget:self action:@selector(didClickLeft) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem * leftBarBtn = [[UIBarButtonItem alloc] initWithCustomView:leftBtn];
    self.navigationItem.leftBarButtonItem = leftBarBtn;
 
}

- (void)setupViews {
    
    NSArray * nameArr = @[@"账号密码登录", @"快捷免密登录"];
    ZXPasswordLoginViewController * passwordVC = [[ZXPasswordLoginViewController alloc] init];
    ZXFastLoginViewController * fastVC = [[ZXFastLoginViewController alloc] init];
    NSArray * controllersArr = @[passwordVC, fastVC];
    
    SelectedView * selectedView = [[SelectedView alloc] initWithFrame:CGRectMake(0, 64, DEVICE_SCREEN_WIDTH, DEVICE_SCREEN_HEIGHT - 64) buttonName:nameArr controllers:controllersArr parentController:self];
    [self.view addSubview:selectedView];
}

#pragma - 点击事件
- (void)didClickRight {
    
    NSLog(@"点击转换");
    
    ZXRegiserViewController * regiserVC = [[ZXRegiserViewController alloc] init];
    
    [self.navigationController pushViewController:regiserVC animated:YES];
    
}

- (void)didClickLeft {

    NSLog(@"点击按钮");
    [self dismissViewControllerAnimated:YES completion:nil];
    
}



@end
